#!/bin/bash

# 构建前端
echo "===== 构建前端 ====="
cd client
npm install
npm run build
cd ..

# 部署到Gitee Pages
echo "===== 准备部署到Gitee Pages ====="
mkdir -p deploy
cp -r client/build/* deploy/

echo "===== 推送到Gitee仓库 ====="
cd deploy
git init
git add .
git commit -m "Deploy: 更新前端内容 $(date)"

# 设置Gitee仓库地址（您的Gitee用户名）
git remote add origin https://gitee.com/baogeliying/yyb-photo-system.git

# 强制推送到Gitee的Pages分支
git push -f origin master:pages

# 清理
cd ..
echo "===== 部署完成 =====" 